import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App2 from './App2'
import * as Api from './api'
import * as Store from './store'
import { autorun, configure, observable, action, runInAction } from 'mobx'
import { configureDevtool } from 'mobx-react-devtools'

configure({
  enforceActions: 'observed'
})

configureDevtool({
  logEnabled: true,
  updatesEnabled: true,
  graphEnabled: false,
})

// class Clock {
//   @observable seconds: number = 0

//   get milliseconds() {
//     return this.seconds * 1000
//   }

//   @action
//   setSeconds(value: number) {
//     this.seconds = value
//   }

//   constructor() {
//   }
// }

// const c = new Clock()

// setInterval(() => {
//   // runInAction(() => {
//   // c.seconds = c.seconds + 1
//   // })
//   c.setSeconds(c.seconds + 1)

// }, 1000)

// autorun(() => {
//   console.log('recomput seconds', c.milliseconds)
// })

// @ts-ignore
window['$api'] = Api
// @ts-ignore
window['$store'] = Store

// ReactDOM.render(
//   <DevTools />,
//   document.getElementById('root')
// )

ReactDOM.render(
  <App2 />,
  document.getElementById('root')
)
